# coding=utf-8
# lsta = (raw_input('input list a:')).split(' ')
# lstb = (raw_input('input list b:')).split(' ')

def get(lst1, lst2):
    def index(lst, i):
        if len(lst) == 0:
            return 0
        for l in lst:
            if i > l:
                continue
            return lst.index(l)
        return len(lst)

    lst = []
    for i in lsta:
        for j in lstb:
            if i <= j:
                break
            if not j in lst:
                lst.insert(index(lst, j), j)
                print j,
        if not i in lst:
            lst.insert(index(lst, i), i)
            print i,
        else:
            continue

    if max(lsta) in lst:
      for k in lstb:
          if not k in lst:
              lst.insert(index(lst, k), k)
              print k,
    return lst
    
if __name__ == '__main__':
    lsta = [2, 4, 6, 8]
    lstb = [1, 3, 5, 7, 9, 11, 13]
    print get(lsta, lstb)
    lsta = [2, 4, 6, 8, 10, 12, 14]
    lstb = [1, 3, 5, 7, 9, 11, 13]
    print get(lsta, lstb)
    # output:
    # [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13]
    # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
    
    